package net.tngou.iask.action.my;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;

import net.tngou.iask.action.BaseAction;
import net.tngou.iask.entity.Statistic;
import net.tngou.iask.service.StatisticService;

/**
 * 日常统计
 * @author tngou@tngou.net
 *
 */
public class DailyAction extends BaseAction {

	/**
	 * 日常首页
	 */
	@Override
	public void execute() throws ServletException, IOException {
		
		StatisticService service = new StatisticService();
		Statistic patient = service.getPatient(user.getMain());
		Statistic access =service.getAccess(user.getMain());
		Statistic cure =service.getCure(user.getMain());
		root.put("patient", patient);
		root.put("access", access);
		root.put("cure", cure);
		printFreemarker("my/daily.ftl", root);
	}
	
	/**
	 * 日常患者统计
	 */
	public void patient() {
		StatisticService service = new StatisticService();
		Statistic patient = service.getPatient(user.getMain());
		List<Statistic> list = service.getPatientAge(user.getMain());
		root.put("patient", patient);
		root.put("ages", list);
		printFreemarker("my/daily_patient.ftl", root);
	}
	
	/**
	 * 日常治疗统计
	 */
	public void cure() {
		StatisticService service = new StatisticService();
		Statistic cure = service.getPatient(user.getMain());
		root.put("cure", cure);
		printFreemarker("my/daily_cure.ftl", root);
	}
	
	/**
	 * 日常随访统计
	 */
	public void access() {
		StatisticService service = new StatisticService();
		Statistic access = service.getAccess(user.getMain());
		root.put("access", access);
		printFreemarker("my/daily_access.ftl", root);
	}
	
	
}
